<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./jquery-1.11.3.js"></script>
</head>
<body>
    <div></div>
    <div></div>
    <div></div>
    <script>
        // console.log($('div'));
        var div = document.getElementsByTagName('div')[0];
        //转化jquery对象(变量名使用$前缀)
        var $div = $(div);
        console.log(div);
        console.log($div);
        console.log($div[0]);
        console.log($div.get(0));

        //操作元素
        div.innerHTML = "原生innerHTML书写";
        div.setAttribute("id","d1");

        //jquery 操作元素内容和属性
        $('div').html('jquery 动态添加');
        $('div').attr('class','c1');

        //调用对象不存在的方法,报错
        // $('div').setAttribute('id','d1');

        // 不起作用,不报错,对象访问不存在的属性
        // $('div').innerHTML = "jquery";


    </script>
</body>
</html>